Skip to content

non_gps: added feature matching and offset calculation#62

Draft
snktshrma wants to merge 8 commits intoArduPilot:masterfrom
snktshrma:master
Draft

non_gps: added feature matching and offset calculation#62
snktshrma wants to merge 8 commits intoArduPilot:masterfrom
snktshrma:master

Conversation

@snktshrma
Copy link
Member

This is a draft PR, referenced to the #23471 by @rmackay9. As of now, PR provides basic outline for the image feature detection and getting offsets, orientation and zoom. Alongside, we are able to extract new lat and long based on pixel offset. Functions to store old lat and log, alongside altitude data is also added.
Two test images are added for testing purposes.

This is a small part to the whole solution for the issue and it'll be updated frequently under this PR for the complete feature development.

kp2, des2 = sift.detectAndCompute(img2,None)
FLANN_INDEX_KDTREE = 1
index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5)
search_params = dict(checks = 50)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you plan to run this to run at a regular rate, it might be wise to iteratively adjust the checks over time to optimize the computation time against the desired output rate. It might depend if you want to run this algorithm on every frame, or skip frames in order to get higher checks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood sir! You mean it could be better to do frequent checks on image frames rather than continuous checks on frames, I'll make it to check for features at frequent intervals

if len(good)>MIN_MATCH_COUNT:
src_pts = np.float32([ kp1[m.queryIdx].pt for m in good ]).reshape(-1,1,2)
dst_pts = np.float32([ kp2[m.trainIdx].pt for m in good ]).reshape(-1,1,2)
M, mask = cv.findHomography(src_pts, dst_pts, cv.RANSAC,5.0)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For finding homography, since the images are in quick succession and not arbitrarily different transforms, are there any algorithms that may be optimized based on an initial guess?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ryanf55 I am not sure if it is what you are mentioning, but Iterative Closest Point algorithm can serve the purpose. If it is required, I'll add it in the main algorithm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants